import typing
from pydantic_settings import BaseSettings

class Settings(BaseSettings):
    QMT_DIR:str = r'D:\江海证券QMT实盘_交易\userdata_mini'
    ACC:str = "80395788"
    API: str = "http://stockapi.yanjin.pro/api/data/jiaoyi/add_orders"
    STOCK_CODE: typing.List = [
        {"id": "513130", "name": "恒生科技", "all_code": "513130.SH", "type": 1, "span": 0.001,"volume":100},
        {"id": "513060", "name": "恒生医疗", "all_code": "513060.SH", "type": 1, "span": 0.001,"volume":100},
        {"id": "513120", "name": "创新药", "all_code": "513120.SH", "type": 1, "span": 0.002,"volume":100},
        {"id": "513090", "name": "香港证券", "all_code": "513090.SH", "type": 1, "span": 0.003,"volume":100},
        {"id": "513050", "name": "互联网", "all_code": "513050.SH", "type": 1, "span": 0.001,"volume":100},
        {"id": "513750", "name": "港股通", "all_code": "513750.SH", "type": 1, "span": 0.002, "volume": 100},
        {"id": "159210", "name": "汽车", "all_code": "159210.SZ", "type": 1, "span": 0.001, "volume": 100},
        {"id": "513310", "name": "半导体", "all_code": "513310.SH", "type": 1, "span": 0.002, "volume": 100},
        {"id": "159268", "name": "通消费", "all_code": "159268.SZ", "type": 1, "span": 0.001, "volume": 100},
        {"id": "159615", "name": "生物科技", "all_code": "159615.SZ", "type": 1, "span": 0.001, "volume": 100},
        {"id": "520500", "name": "恒生创新药", "all_code": "520500.SH", "type": 1, "span": 0.002, "volume": 100},
    ]
    UPDOWN_TIME:int = 60  ##横盘时间,60个tick,约3分钟
    UPDOWN_SPAN:float = 0.2 ##横盘区间大小
    GIVE_SPAN:int = 4 ##止损挡位,往下两档
    # ATR 配置
    ATR_LOOKBACK:int = 14  # 日内分钟级建议 7~14
    ATR_X:float = 0.4      # ATR 倍数（2~5），用于阈值放大


settings = Settings()
